using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TemplateWizard;
using System.Windows.Forms;
using EnvDTE;

namespace SPVisualDev
{
    public class NewFeatureWizard: IWizard
    {
        private DTE m_DTE;
        private string m_feature_name;

        public NewFeatureWizard()
        {
        }

        // This method is called before opening any item that 
        // has the OpenInEditor attribute.
        public void BeforeOpeningFile(ProjectItem projectItem)
        {
        }

        public void ProjectFinishedGenerating(Project project)
        {
        }

        // This method is only called for item templates,
        // not for project templates.
        public void ProjectItemFinishedGenerating(ProjectItem projectItem)
        {
        }

        // This method is called after the project is created.
        public void RunFinished()
        {
        }

        public void RunStarted(object automationObject,
            Dictionary<string, string> replacementsDictionary,
            WizardRunKind runKind, object[] customParams)
        {
            try
            {
                //System.Diagnostics.Debugger.Break();

                m_DTE = (DTE)automationObject;
                m_feature_name = replacementsDictionary["$rootname$"];

                replacementsDictionary["$guid10$"] = Guid.NewGuid().ToString("D").ToUpper();


            }
            catch (Exception ex)
            {
                DialogError.ShowError(ex);
            }
        }

        // This method is only called for item templates,
        // not for project templates.
        public bool ShouldAddProjectItem(string filePath)
        {
            return true;
        }
    }
}

